<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var fn = function() {
            let arr = readline().split(' ').map(Number);
            let n = arr[0]
            let x = arr[1]
            let c = arr[2]
            let arr1 = readline().split(' ').map(Number);
            var count;
            for (let i = 0; i < n; i++) {
                if (arr1[i] > c && Math.abs(arr1[i] - x) <= 3) {
                    count++;
                }
            }
            console.log(count);
        }
    </script>
</body>

</html>